package com.zqw.service.impl;

import com.zqw.info.AuthInfo;
import com.zqw.mapper.AuthMapper;
import com.zqw.pojo.AuthPojo;
import com.zqw.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuthServiceImpl implements AuthService {

    @Autowired
    AuthMapper authMapper;

    //查询所有的权限
    @Override
    public List<AuthPojo> queryAuth(AuthInfo authInfo) {
        List<AuthPojo> authPojos = authMapper.queryAuth(authInfo);
        return authPojos;
    }

    /**
     * 根据id删除权限
     * @param id
     * @return
     */
    public boolean delOneAuth(String id){
        boolean b = authMapper.delAuth(id);
        return b;
    }

    /**
     * 根据ids删除一批权限
     * @param ids
     * @return
     */
    public boolean delAuths(String ids){
        boolean b = authMapper.delAuth(ids.substring(0, ids.length() - 1));
        return b;
    }

    /**
     * 根据类型查询
     * @param type
     * @return
     */
    public List<AuthPojo> queryAuthByType(String type){
        List<AuthPojo> authPojos = authMapper.queryAuthByType(type);
        return authPojos;
    }
}
